/**
  ******************************************************************************
  * @文件名           : bsp_gpio.h
  * @作者             : citunhk
  * @功能介绍         : GPIO输入输出驱动函数
  *	@日期             : 2022.10.31
  ******************************************************************************
  * @注意
  *
  * 本文件中不应调用上层文件
  *
  ******************************************************************************
  *更改记录
  *日期 修改人 修改内容
  *
  *
  *
  ******************************************************************************
  */
#ifndef __BSP_GPIO_H
#define __BSP_GPIO_H

#include "stm32g0xx_ll_gpio.h"

#define LED_Green_Port	        GPIOB                 //运行灯
#define LED_Green_Pin	        LL_GPIO_PIN_11

#define LED_Red_Port	        GPIOB                 //报警灯
#define LED_Red_Pin	            LL_GPIO_PIN_12

#define CTR_Master_Port			GPIOC                 //RS485主站收发控制
#define CTR_Master_Pin			LL_GPIO_PIN_12

#define CTR_Slave_Port		    GPIOC                 //RS485从站收发控制
#define CTR_Slave_Pin			LL_GPIO_PIN_13

#define BUZZER_Port			    GPIOC                 //蜂鸣器
#define BUZZER_Pin			    LL_GPIO_PIN_3

#define Photocoupler_DGT1_Port    GPIOB               //数字量输入1
#define Photocoupler_DGT1_Pin	  LL_GPIO_PIN_6

#define Photocoupler_DGT2_Port	  GPIOB               //数字量输入2
#define Photocoupler_DGT2_Pin	  LL_GPIO_PIN_7

#define Photocoupler_DGT3_Port	  GPIOB               //数字量输入3
#define Photocoupler_DGT3_Pin	  LL_GPIO_PIN_8

#define Photocoupler_DGT4_Port    GPIOB               //数字量输入4
#define Photocoupler_DGT4_Pin	  LL_GPIO_PIN_9

#define Photocoupler_DGT5_Port	  GPIOC               //数字量输入5
#define Photocoupler_DGT5_Pin	  LL_GPIO_PIN_10

#define Photocoupler_DGT6_Port	  GPIOC               //数字量输入6
#define Photocoupler_DGT6_Pin	  LL_GPIO_PIN_11

#define Photocoupler_DGT7_Port    GPIOC               //数字量输入7
#define Photocoupler_DGT7_Pin	  LL_GPIO_PIN_12

#define Photocoupler_Pulse_Port   GPIOB               //脉冲输入
#define Photocoupler_Pulse_Pin	  LL_GPIO_PIN_5

#define Relays_K1_Port			GPIOD                 //继电器输出1
#define Relays_K1_Pin			LL_GPIO_PIN_1

#define Relays_K2_Port			GPIOD                 //继电器输出2
#define Relays_K2_Pin			LL_GPIO_PIN_0

#define Relays_K3_Port			GPIOC                 //继电器输出3
#define Relays_K3_Pin			LL_GPIO_PIN_9

#define Silicon_U1_Port			GPIOB                 //可控硅输出1
#define Silicon_U1_Pin			LL_GPIO_PIN_4

#define Silicon_U2_Port			GPIOD                 //可控硅输出2
#define Silicon_U2_Pin			LL_GPIO_PIN_4

#define Silicon_U3_Port			GPIOD                 //可控硅输出3
#define Silicon_U3_Pin			LL_GPIO_PIN_3

#define Silicon_U4_Port			GPIOD                 //可控硅输出4
#define Silicon_U4_Pin			LL_GPIO_PIN_2

typedef enum
{
	PIN_RESET = 0U,
	PIN_SET,
	PIN_TOGGLE
}pinState_t;

void BSP_GPIO_OutputOperate(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint8_t command);
uint8_t BSP_GPIO_InputRead(GPIO_TypeDef *GPIOx, uint32_t PinMask);

#endif
